<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // if语句
        let age = 18;
        if(age >= 18){
            console.log('可以投票');
        }else{
            console.log('不可以投票');
        }

        // if else if else语句
        let score = 90;
        if(score >= 90){
            console.log('优秀');
        }else if(score >= 80){
            console.log('良好');
        }else if(score >= 70){
            console.log('中等');
        }else if(score >= 60){
            console.log('及格');
        }else{
            console.log('不及格');
        }

        // 三元运算符
        let num = 10;
        let result = num > 0 ? '正数' : '负数';
        console.log(result);


        // switch语句
        let day = 3;
        switch(day){
            case 1:
                console.log('星期一');
                break;
            case 2:
                console.log('星期二');
                break;
            case 3:
                console.log('星期三');
                break;
            case 4:
                console.log('星期四');
                break;
            case 5:
                console.log('星期五');
                break;
            case 6:
                console.log('星期六');
                break;
            case 7:
                console.log('星期日');
                break;
            default:
                console.log('输入错误');
        }
    
    </script>
</body>
</html>